package com.waiter.moximoxi.utils;

import android.content.Context;
import android.os.Build;

import com.waiter.moximoxi.presenter.Constants;

import cn.yhong.aframework.utils.AtyUtils;

/**
 * Created by 17639 on 2020/10/21.
 * 内置打印机工具类
 */

public class PrintUtils {

    private static String getModel() {
        return Build.MODEL;
    }

    public static boolean canSupport(int support, Context context) {
        String model = getModel();
        int value = getModelValue(model);
        if ((support & value) == value) {
            return true;
        }
        AtyUtils.showShort(context, "该终端【" + model + "】暂不支持该模块", true);
        return false;
    }

    private static int getModelValue(String model) {
        if (model.equalsIgnoreCase(Constants.TerminalType.MODEL_W280P)) {
            return Constants.ModelSupport.SUPPORT_MODEL_W280P;
        } else if (model.equalsIgnoreCase(Constants.TerminalType.MODEL_W280PV2)) {
            return Constants.ModelSupport.SUPPORT_MODEL_W280PV2;
        } else if (model.equalsIgnoreCase(Constants.TerminalType.MODEL_W280PV3)) {
            return Constants.ModelSupport.SUPPORT_MODEL_W280PV3;
        } else if (model.equalsIgnoreCase(Constants.TerminalType.MODEL_P950)) {
            return Constants.ModelSupport.SUPPORT_MODEL_P950;
        } else if (model.equalsIgnoreCase(Constants.TerminalType.MODEL_P960)) {
            return Constants.ModelSupport.SUPPORT_MODEL_P960;
        } else if (model.equalsIgnoreCase(Constants.TerminalType.MODEL_P990)) {
            return Constants.ModelSupport.SUPPORT_MODEL_P990;
        } else if (model.equalsIgnoreCase(Constants.TerminalType.MODEL_P990V2)) {
            return Constants.ModelSupport.SUPPORT_MODEL_P990V2;
        } else if (model.equalsIgnoreCase(Constants.TerminalType.MODEL_APOS_A8)) {
            return Constants.ModelSupport.SUPPORT_MODEL_APOS_A8;
        } else if (model.equalsIgnoreCase(Constants.TerminalType.MODEL_AECR_C10)) {
            return Constants.ModelSupport.SUPPORT_MODEL_AECR_C10;
        } else {
            return Constants.ModelSupport.SUPPORT_MODEL_NONE;
        }
    }

}
